using System.Collections.Generic;
using OracleInternal.SqlAndPlsqlParser.LocalParsing;

namespace OracleInternal.SqlAndPlsqlParser.RuleProcessors.ODPCommands
{
	internal static class OracleMbEarleyTypeConstructorExpressionRuleMultiProcessors
	{
		public static OracleMbEarleyRuleMultiProcessorAddItem[] s_vRuleProcessorItems;

		static OracleMbEarleyTypeConstructorExpressionRuleMultiProcessors()
		{
			OracleMbEarleyRuleMultiProcessorAddItem[] array = new OracleMbEarleyRuleMultiProcessorAddItem[8];
			OracleMbEarleyRuleMultiProcessorAddItem oracleMbEarleyRuleMultiProcessorAddItem = new OracleMbEarleyRuleMultiProcessorAddItem
			{
				m_vHeadSymbol = "type_constructor_expression",
				m_vRHSSymbols = new string[2]
				{
					"identifier",
					"'('"
				},
				m_vRuleProcessor = Process_TypeConstructorExpression_Identifier_LeftParenthesis_StartWithRule,
				m_vAddType = OracleMbEarleyRuleMultiProcessorAddType.AllRulesStartingWith
			};
			array[0] = oracleMbEarleyRuleMultiProcessorAddItem;
			oracleMbEarleyRuleMultiProcessorAddItem = new OracleMbEarleyRuleMultiProcessorAddItem
			{
				m_vHeadSymbol = "type_constructor_expression",
				m_vRHSSymbols = new string[4]
				{
					"identifier",
					"'.'",
					"identifier",
					"'('"
				},
				m_vRuleProcessor = Process_TypeConstructorExpression_Identifier_Dot_Identifier_LeftParenthesis_StartWithRule,
				m_vAddType = OracleMbEarleyRuleMultiProcessorAddType.AllRulesStartingWith
			};
			array[1] = oracleMbEarleyRuleMultiProcessorAddItem;
			oracleMbEarleyRuleMultiProcessorAddItem = new OracleMbEarleyRuleMultiProcessorAddItem
			{
				m_vHeadSymbol = "type_constructor_expression",
				m_vRHSSymbols = new string[3]
				{
					"'NEW'",
					"identifier",
					"'('"
				},
				m_vRuleProcessor = Process_TypeConstructorExpression_New_Identifier_LeftParenthesis_StartWithRule,
				m_vAddType = OracleMbEarleyRuleMultiProcessorAddType.AllRulesStartingWith
			};
			array[2] = oracleMbEarleyRuleMultiProcessorAddItem;
			oracleMbEarleyRuleMultiProcessorAddItem = new OracleMbEarleyRuleMultiProcessorAddItem
			{
				m_vHeadSymbol = "type_constructor_expression",
				m_vRHSSymbols = new string[5]
				{
					"'NEW'",
					"identifier",
					"'.'",
					"identifier",
					"'('"
				},
				m_vRuleProcessor = Process_TypeConstructorExpression_New_Identifier_Dot_Identifier_LeftParenthesis_StartWithRule,
				m_vAddType = OracleMbEarleyRuleMultiProcessorAddType.AllRulesStartingWith
			};
			array[3] = oracleMbEarleyRuleMultiProcessorAddItem;
			oracleMbEarleyRuleMultiProcessorAddItem = new OracleMbEarleyRuleMultiProcessorAddItem
			{
				m_vHeadSymbol = "type_constructor_expression",
				m_vRHSSymbols = new string[1]
				{
					"expr"
				},
				m_vRuleProcessor = Process_TypeConstructorExpression_Expr_Rule,
				m_vAddType = OracleMbEarleyRuleMultiProcessorAddType.SpecificRule
			};
			array[4] = oracleMbEarleyRuleMultiProcessorAddItem;
			oracleMbEarleyRuleMultiProcessorAddItem = new OracleMbEarleyRuleMultiProcessorAddItem
			{
				m_vHeadSymbol = "type_constructor_expression",
				m_vRHSSymbols = new string[2]
				{
					"expr",
					"type_constructor_expression"
				},
				m_vRuleProcessor = Process_TypeConstructorExpression_Expr_TypeConstructorExpression_Rule,
				m_vAddType = OracleMbEarleyRuleMultiProcessorAddType.SpecificRule
			};
			array[5] = oracleMbEarleyRuleMultiProcessorAddItem;
			oracleMbEarleyRuleMultiProcessorAddItem = new OracleMbEarleyRuleMultiProcessorAddItem
			{
				m_vHeadSymbol = "type_constructor_expression",
				m_vRHSSymbols = new string[2]
				{
					"','",
					"expr"
				},
				m_vRuleProcessor = Process_TypeConstructorExpression_Comma_Expr_Rule,
				m_vAddType = OracleMbEarleyRuleMultiProcessorAddType.SpecificRule
			};
			array[6] = oracleMbEarleyRuleMultiProcessorAddItem;
			oracleMbEarleyRuleMultiProcessorAddItem = new OracleMbEarleyRuleMultiProcessorAddItem
			{
				m_vHeadSymbol = "type_constructor_expression",
				m_vRHSSymbols = new string[3]
				{
					"type_constructor_expression",
					"','",
					"expr"
				},
				m_vRuleProcessor = Process_TypeConstructorExpression_TypeConstructorExpression_Comma_Expr_Rule,
				m_vAddType = OracleMbEarleyRuleMultiProcessorAddType.SpecificRule
			};
			array[7] = oracleMbEarleyRuleMultiProcessorAddItem;
			s_vRuleProcessorItems = array;
		}

		public static object Process_TypeConstructorExpression_Identifier_LeftParenthesis_StartWithRule(OracleMbEarleyParserMultiContext ctx, int ruleMatchPosition)
		{
			List<ParseNode> list = ctx.CurrentParseNode.Children();
			OracleLpTypeConstructorExpression oracleLpTypeConstructorExpression = new OracleLpTypeConstructorExpression(null);
			OracleLpExpression ao = (OracleLpExpression)ctx.GetActiveObject(11);
			ctx.SetActiveObject(11, oracleLpTypeConstructorExpression);
			oracleLpTypeConstructorExpression.Name = new OracleLpName(ctx.Tokens[list[0].From].m_vContent);
			if (list.Count > 3)
			{
				OracleMbEarleyRuleMultiProcessor.ProcessNodeRules(list[2], 0, -1, ctx);
			}
			ctx.SetActiveObject(11, ao);
			return oracleLpTypeConstructorExpression;
		}

		public static object Process_TypeConstructorExpression_Identifier_Dot_Identifier_LeftParenthesis_StartWithRule(OracleMbEarleyParserMultiContext ctx, int ruleMatchPosition)
		{
			List<ParseNode> list = ctx.CurrentParseNode.Children();
			OracleLpTypeConstructorExpression oracleLpTypeConstructorExpression = new OracleLpTypeConstructorExpression(null);
			OracleLpExpression ao = (OracleLpExpression)ctx.GetActiveObject(11);
			ctx.SetActiveObject(11, oracleLpTypeConstructorExpression);
			oracleLpTypeConstructorExpression.ParentObjectName = new OracleLpName(ctx.Tokens[list[0].From].m_vContent);
			oracleLpTypeConstructorExpression.Name = new OracleLpName(ctx.Tokens[list[2].From].m_vContent);
			if (list.Count > 5)
			{
				OracleMbEarleyRuleMultiProcessor.ProcessNodeRules(list[4], 0, -1, ctx);
			}
			ctx.SetActiveObject(11, ao);
			return oracleLpTypeConstructorExpression;
		}

		public static object Process_TypeConstructorExpression_New_Identifier_LeftParenthesis_StartWithRule(OracleMbEarleyParserMultiContext ctx, int ruleMatchPosition)
		{
			List<ParseNode> list = ctx.CurrentParseNode.Children();
			OracleLpTypeConstructorExpression oracleLpTypeConstructorExpression = new OracleLpTypeConstructorExpression(null);
			OracleLpExpression ao = (OracleLpExpression)ctx.GetActiveObject(11);
			ctx.SetActiveObject(11, oracleLpTypeConstructorExpression);
			oracleLpTypeConstructorExpression.Name = new OracleLpName(ctx.Tokens[list[1].From].m_vContent);
			if (5 == list.Count)
			{
				OracleMbEarleyRuleMultiProcessor.ProcessNodeRules(list[3], 0, -1, ctx);
			}
			ctx.SetActiveObject(11, ao);
			return oracleLpTypeConstructorExpression;
		}

		public static object Process_TypeConstructorExpression_New_Identifier_Dot_Identifier_LeftParenthesis_StartWithRule(OracleMbEarleyParserMultiContext ctx, int ruleMatchPosition)
		{
			List<ParseNode> list = ctx.CurrentParseNode.Children();
			OracleLpTypeConstructorExpression oracleLpTypeConstructorExpression = new OracleLpTypeConstructorExpression(null);
			OracleLpExpression ao = (OracleLpExpression)ctx.GetActiveObject(11);
			ctx.SetActiveObject(11, oracleLpTypeConstructorExpression);
			oracleLpTypeConstructorExpression.ParentObjectName = new OracleLpName(ctx.Tokens[list[1].From].m_vContent);
			oracleLpTypeConstructorExpression.Name = new OracleLpName(ctx.Tokens[list[3].From].m_vContent);
			if (7 == list.Count)
			{
				OracleMbEarleyRuleMultiProcessor.ProcessNodeRules(list[5], 0, -1, ctx);
			}
			ctx.SetActiveObject(11, ao);
			return oracleLpTypeConstructorExpression;
		}

		public static object Process_TypeConstructorExpression_Expr_Rule(OracleMbEarleyParserMultiContext ctx, int ruleMatchPosition)
		{
			OracleMbEarleyRuleMultiProcessorTable ruleProcessorTable = ctx.RuleProcessorTable;
			ctx.RuleProcessorTable = ctx.GetRuleProcessorTable("expr");
			OracleLpExpression oracleLpExpression = OracleMbEarleyRuleMultiProcessor.ProcessNodeRules(ctx.CurrentParseNode, ctx.CurrentRuleIndex + 1, -1, ctx) as OracleLpExpression;
			ctx.RuleProcessorTable = ruleProcessorTable;
			List<LexerToken> tokens = ctx.Tokens;
			ParseNode currentParseNode = ctx.CurrentParseNode;
			int vBegin = tokens[currentParseNode.From].m_vBegin;
			int vEnd = tokens[currentParseNode.To - 1].m_vEnd;
			oracleLpExpression.Text = new OracleLpTextFragment(ctx.Script, vBegin, vEnd - vBegin);
			OracleLpTypeConstructorExpression oracleLpTypeConstructorExpression = ctx.GetActiveObject(11) as OracleLpTypeConstructorExpression;
			if (oracleLpTypeConstructorExpression.Parameters == null)
			{
				oracleLpTypeConstructorExpression.CreateParametersList();
			}
			oracleLpTypeConstructorExpression.Parameters.Add(oracleLpExpression);
			oracleLpExpression.ParentExpression = oracleLpTypeConstructorExpression;
			oracleLpTypeConstructorExpression.ParametersChanged();
			return oracleLpTypeConstructorExpression;
		}

		public static object Process_TypeConstructorExpression_Expr_TypeConstructorExpression_Rule(OracleMbEarleyParserMultiContext ctx, int ruleMatchPosition)
		{
			List<ParseNode> list = ctx.CurrentParseNode.Children();
			OracleMbEarleyRuleMultiProcessorTable ruleProcessorTable = ctx.RuleProcessorTable;
			ctx.RuleProcessorTable = ctx.GetRuleProcessorTable("expr");
			OracleLpExpression oracleLpExpression = OracleMbEarleyRuleMultiProcessor.ProcessNodeRules(list[0], 0, -1, ctx) as OracleLpExpression;
			ctx.RuleProcessorTable = ruleProcessorTable;
			List<LexerToken> tokens = ctx.Tokens;
			ParseNode currentParseNode = ctx.CurrentParseNode;
			int vBegin = tokens[currentParseNode.From].m_vBegin;
			oracleLpExpression.Text = new OracleLpTextFragment(length: tokens[currentParseNode.To - 1].m_vEnd - vBegin, text: ctx.Script, start: vBegin);
			OracleLpTypeConstructorExpression oracleLpTypeConstructorExpression = ctx.GetActiveObject(11) as OracleLpTypeConstructorExpression;
			if (oracleLpTypeConstructorExpression.Parameters == null)
			{
				oracleLpTypeConstructorExpression.CreateParametersList();
			}
			oracleLpTypeConstructorExpression.Parameters.Add(oracleLpExpression);
			oracleLpExpression.ParentExpression = oracleLpTypeConstructorExpression;
			OracleMbEarleyRuleMultiProcessor.ProcessNodeRules(list[1], 0, -1, ctx);
			oracleLpTypeConstructorExpression.ParametersChanged();
			return oracleLpTypeConstructorExpression;
		}

		public static object Process_TypeConstructorExpression_Comma_Expr_Rule(OracleMbEarleyParserMultiContext ctx, int ruleMatchPosition)
		{
			List<ParseNode> list = ctx.CurrentParseNode.Children();
			OracleMbEarleyRuleMultiProcessorTable ruleProcessorTable = ctx.RuleProcessorTable;
			ctx.RuleProcessorTable = ctx.GetRuleProcessorTable("expr");
			OracleLpExpression oracleLpExpression = OracleMbEarleyRuleMultiProcessor.ProcessNodeRules(list[1], 0, -1, ctx) as OracleLpExpression;
			ctx.RuleProcessorTable = ruleProcessorTable;
			List<LexerToken> tokens = ctx.Tokens;
			ParseNode currentParseNode = ctx.CurrentParseNode;
			int vBegin = tokens[currentParseNode.From].m_vBegin;
			int vEnd = tokens[currentParseNode.To - 1].m_vEnd;
			oracleLpExpression.Text = new OracleLpTextFragment(ctx.Script, vBegin, vEnd - vBegin);
			OracleLpTypeConstructorExpression oracleLpTypeConstructorExpression = ctx.GetActiveObject(11) as OracleLpTypeConstructorExpression;
			if (oracleLpTypeConstructorExpression.Parameters == null)
			{
				oracleLpTypeConstructorExpression.CreateParametersList();
			}
			oracleLpTypeConstructorExpression.Parameters.Add(oracleLpExpression);
			oracleLpExpression.ParentExpression = oracleLpTypeConstructorExpression;
			oracleLpTypeConstructorExpression.ParametersChanged();
			return oracleLpTypeConstructorExpression;
		}

		public static object Process_TypeConstructorExpression_TypeConstructorExpression_Comma_Expr_Rule(OracleMbEarleyParserMultiContext ctx, int ruleMatchPosition)
		{
			List<ParseNode> list = ctx.CurrentParseNode.Children();
			OracleMbEarleyRuleMultiProcessor.ProcessNodeRules(list[0], 0, -1, ctx);
			OracleMbEarleyRuleMultiProcessorTable ruleProcessorTable = ctx.RuleProcessorTable;
			ctx.RuleProcessorTable = ctx.GetRuleProcessorTable("expr");
			OracleLpExpression oracleLpExpression = OracleMbEarleyRuleMultiProcessor.ProcessNodeRules(list[2], 0, -1, ctx) as OracleLpExpression;
			ctx.RuleProcessorTable = ruleProcessorTable;
			List<LexerToken> tokens = ctx.Tokens;
			ParseNode currentParseNode = ctx.CurrentParseNode;
			int vBegin = tokens[currentParseNode.From].m_vBegin;
			int vEnd = tokens[currentParseNode.To - 1].m_vEnd;
			oracleLpExpression.Text = new OracleLpTextFragment(ctx.Script, vBegin, vEnd - vBegin);
			OracleLpTypeConstructorExpression oracleLpTypeConstructorExpression = ctx.GetActiveObject(11) as OracleLpTypeConstructorExpression;
			if (oracleLpTypeConstructorExpression.Parameters == null)
			{
				oracleLpTypeConstructorExpression.CreateParametersList();
			}
			oracleLpTypeConstructorExpression.Parameters.Add(oracleLpExpression);
			oracleLpExpression.ParentExpression = oracleLpTypeConstructorExpression;
			oracleLpTypeConstructorExpression.ParametersChanged();
			return oracleLpTypeConstructorExpression;
		}
	}
}
